﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ERP.Page;
namespace ERP.Page
{
    public partial class Site : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SetCurrentPage();
        }
        public void OpenDialog(string dialogId)
        {
            var sb = new StringBuilder();
            sb.Append("$('" + dialogId + "').dialog('open');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(),
                "scriptKey", sb.ToString(), true);
        }
        #region[SetPage]
        private void SetCurrentPage()
        {
            var pageName = GetPageName();

            switch (pageName)
            {
                case "Order.aspx":
                    QuanLyMuaHang.Attributes["class"] = "nav nav-list collapse in";
                    DonMuaHang.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Order-Buy.aspx":
                    QuanLyMuaHang.Attributes["class"] = "nav nav-list collapse in";
                    MuaHang.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                //------------------------------------------------------------------
                case "Import-Order.aspx":
                    QuanLyKho.Attributes["class"] = "nav nav-list collapse in";
                    //PhieuNhapKho.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Export.aspx":
                    QuanLyKho.Attributes["class"] = "nav nav-list collapse in";
                    PhieuXuatKho.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                //------------------------------------------------------------------
                case "Enterprise.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    LoaiDoanhNghiep.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Bank.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    NganHang.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Ethnic.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    DanToc.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Currency.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    TienTe.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "National.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    QuocGia.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Domain.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    Mien.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Province.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    Tinh.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "District.aspx":
                    DanhMucChung.Attributes["class"] = "nav nav-list collapse in";
                    QuanHuyen.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                //------------------------------------------------------------------
                case "Vocative.aspx":
                    DanhMucKhachHang.Attributes["class"] = "nav nav-list collapse in";
                    DanhXung.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Customer.aspx":
                    DanhMucKhachHang.Attributes["class"] = "nav nav-list collapse in";
                    KhachHang.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Customer-Type.aspx":
                    DanhMucKhachHang.Attributes["class"] = "nav nav-list collapse in";
                    LoaiKhachHang.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Destination.aspx":
                    DanhMucKhachHang.Attributes["class"] = "nav nav-list collapse in";
                    MucDich.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Contact.aspx":
                    DanhMucKhachHang.Attributes["class"] = "nav nav-list collapse in";
                    NguoiLienHe.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Sector.aspx":
                    DanhMucKhachHang.Attributes["class"] = "nav nav-list collapse in";
                    NganhNghe.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Method.aspx":
                    DanhMucKhachHang.Attributes["class"] = "nav nav-list collapse in";
                    PhuongThuc.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                //-------------------------------------------------------------------------
                case "Department.aspx":
                    DanhMucCongTy.Attributes["class"] = "nav nav-list collapse in";
                    PhongBan.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Job.aspx":
                    DanhMucCongTy.Attributes["class"] = "nav nav-list collapse in";
                    ChucVu.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Part.aspx":
                    DanhMucCongTy.Attributes["class"] = "nav nav-list collapse in";
                    BoPhan.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                //-------------------------------------------------------------------------
                case "Income_Expenditure_Method.aspx":
                    DanhMucKeToan.Attributes["class"] = "nav nav-list collapse in";
                    KhoanMucThuChi.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                case "Bank_Account.aspx":
                    DanhMucKeToan.Attributes["class"] = "nav nav-list collapse in";
                    TaiKhoanThuChi.Attributes["style"] = "font-style:italic;font-weight:bold";
                    break;
                //-------------Kết thúc-------------
            }
        }
        private string GetPageName()
        {
            return Request.Url.ToString().Split('/').Last();
        }
        #endregion
    }
}